home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
dax1.exe
/
DAP
/
DAPE
/
DAPINIT.C
next >
Wrap
Text File
|
1992-07-15
|
4KB
|
105 lines
// ╔════════════════════════════════════════════════════════════════════╗
// ║ ║
// ║ module: dapinit.c ║
// ║ abstract: This module contains the initialization code for DAP ║
// ║ ║
// ║ environment: NetWare 3.x v3.11 ║
// ║ Network C for NLMs SDK ║
// ║ CLib v3.11 ║
// ║ ║
// ║ This software is provided as is and carries no warranty ║
// ║ whatsoever. Novell disclaims and excludes any and all implied ║
// ║ warranties of merchantability, title and fitness for a particular ║
// ║ purpose. Novell does not warrant that the software will satisfy ║
// ║ your requirements or that the software is without defect or error ║
// ║ or that operation of the software will be uninterrupted. You are ║
// ║ using the software at your risk. The software is not a product ║
// ║ of Novell, Inc. or any of subsidiaries. ║
// ║ ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ maintenance history: ║
// ║ level date pi description ║
// ╟────────────────────────────────────────────────────────────────────╢
// ║ 001 02/24/92 kl initial release. ║
// ╚════════════════════════════════════════════════════════════════════╝
//
// This could be a library NLM too.
//
#include <stdio.h>
#include <process.h>
#include <library.h>
#include "dap/dapsys.h"
#include "cp/cpapi.h"
#include "h/appl.h"
STATIC int dapInited = FALSE;
T_RC DAPInitialize(char *server, WORD type)
{
if( dapInited ){
DIAG2("Initialized called multiple times");
return DAP_SUCCESS;
}
dapInited = TRUE;
//
// First, get the screen IO APIs ready.
// Then, prepare to receive requests,
// send replies, and maintain sessions.
//
//!! Make sure these don't return until they are ready.
//
if( DAPInitializeIOLogic() ) return DAP_INITFAILED;
else if( DAPInitializeRecvLogic() ) return DAP_INITFAILED;
else if( DAPInitializeSendLogic() ) return DAP_INITFAILED;
else if( DAPInitializeSessLogic() ) return DAP_INITFAILED;
else if( DAPInitializeStatLogic() ) return DAP_INITFAILED;
//
// Finally, start the CP Layer engine. This will start the
// service advertising.
//
else if(CPInitialize(server,type,DAPEnqueueServiceRequest,DAPprintf))
return DAP_INITFAILED;
return DAP_SUCCESS;
}
void DAPDeInitialize()
{
if( dapInited ){
//
// DeInitialize the CP Layer first, so it won't send any
// more messages to the DAP layer...
//
CPDeInitialize();
//
// Now, shut down the DAP engine.
//
//!! Each of these should not return until they have
//!! completely shut themselves down...
//
DAPDeInitializeSendLogic();
DAPDeInitializeRecvLogic();
DAPDeInitializeSessLogic();
DAPDeInitializeStatLogic();
DAPDeInitializeIOLogic();
dapInited = FALSE;
}
else{
DIAG2("DeInitialize DAP called multiple times");
}
}
main()
{
atexit(DAPDeInitialize);
if( DAPInitialize(SERVERNAME, SERVERTYPE) ){
printf("Could not initialize DAP...\n");
exit(1);
}
xDIAG1(RenameThread(GetThreadID(),"DAP_INIT"));
while(1) SuspendThread(GetThreadID());
}